<template>
    <div class="banji">
       <div class="banji1">
            <el-button type="info" class="btn" @click="()=>{this.$router.push('/home-2-1-1')}">返回</el-button>
       <h2>{{this.$route.query.className}}</h2>
       </div>
<!-- 列表区域 -->
       <div class="banji2">
  <el-table
    :data="kechenglist"
    border
    style="width: 100%">
    <el-table-column
      prop="courseId"
      label="课程id"
      width="180">
    </el-table-column>
    <el-table-column
      prop="courseName"
      label="课程名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="schoolYear"
      label="课程时间">
    </el-table-column>
  </el-table>
       </div>
    </div>
</template>

<script>
import { http } from '@/uitl/request'
export default {
    created(){
this.getkecheng()
       // console.log(this.canshu);
    },
    data(){
        return{
         canshu:this.$route.query,
         kechenglist:[],
         dui:{classList:{ cid:this.$route.query.cid}}
        }
    },
    methods:{
//获取班级对应的课程
async getkecheng(){
try {
    const {data:res}=await  http.get(`/class/findById/${this.$route.query.cid}`)
    this.kechenglist=res.data.courseList
   // console.log(res);
} catch (err) {
    Promise.reject(err)
}
},

    }
}
</script>

<style scoped>
.banji{
    line-height: 30px;
}
.btn{
   float:right;
   margin: 3px 10px 5px 0px ;
}
</style>